<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>登录</title>
    <link href="css/mui.css" rel="stylesheet"/>
    <link href="css/user.css" rel="stylesheet"/>
    <style>
        .masks{
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            z-index: 15;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,.7);
            color: #fff;
        }
        .masks img{
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
<div id="app">

    <div class="mui-content">
        <div class="brandAll">
            <div class="brandLogin" style="background-image: url(images/loginBg.png);">
                <div class="brandLoginInner">

                    <div class="brandLoginForm">
                        <div class="showHide show0">
                            <div class="brandLoginLis">
                                <div class="brandLoginLisL">
                                    <img src="images/log_user.png">
                                    <input v-model='inputArr[0]' type="text" name="" placeholder="请输入手机号"
                                           onblur="this.placeholder='请输入手机号'" onfocus="this.placeholder=''">
                                </div>
                            </div>
                            <div class="brandLoginLis">
                                <div class="brandLoginLisL">
                                    <img src="images/log_pass1.png">
                                    <input v-model='inputArr[1]' type="password" name="" placeholder="请输入登录密码"
                                           onblur="this.placeholder='请输入登录密码'" onfocus="this.placeholder=''">
                                </div>
                            </div>
                        </div>
                        
                        <div class="brandLoginBtn showHide show0" @click='pwdLogin'>
                            <a class="bigBtn">登录</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="masks">
        <img src="images/mask.png">
    </div>
</div>
</body>

<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/mui.min.js"></script>
<script type="text/javascript" src="js/vue.js"></script>
<script type="text/javascript" src="js/rem.js"></script>
<script type="text/javascript" src="js/ajax.js"></script>

<script type="text/javascript">
    'use strict'

    is_weixn()
    function is_weixn(){ 
        var ua = navigator.userAgent.toLowerCase(); 
        if(ua.match(/MicroMessenger/i)=="micromessenger") {
            $('.masks').show()
        }
    }
    $(document).ready(function () {
        new Vue({
            el: '#app',
            data: {
                inputArr: [],
                remeberMe: false,
                timeCount: 60,
                ifGeting: false,
                canClick: true
            },
            mounted: function () {
            },
            methods: {
                /**
                 *  密码登录
                 */
                pwdLogin: function () {
                    let url = 'uaa/api/login',
                        that = this,
                        input = that.inputArr

                    if (!input[0]) {
                        mui.alert('', '请输入登录手机号', function () {
                        })
                        // alert('请输入登录手机号')
                        return false
                    } else {
                        if (!input[1]) {
                            mui.alert('', '请输入密码', function () {
                            })
                            // alert('请输入密码')
                            return false
                        } else {
                            let pwdLoginSuc = (data) => {
                                    if (data.code === 1000) {
                                        window.sessionStorage.setItem("Authorization", data.data.access_token)
                                        window.location.href = 'user_list.html'
                                    } else {
                                        mui.alert('', data.msg, function () { })
                                    }
                                    // alert(data.msg)
                                },

                                pwdLoginErr = (err) => {                                    
                                    console.log(err)
                                }

                            common.ajax(url, {
                                mobilephone: input[0],
                                password: input[1],
                                remeberMe: that.remeberMe,
                                loginDevice: '121321312312',
                                loginSource: 'WECHAT'
                            }, pwdLoginSuc, pwdLoginErr)
                        }
                    }
                },
            }
        })

        mui(".loginTab").on('tap', 'ul li', function (event) {
            $(this).addClass("active").siblings().removeClass("active")
            var ind = $(this).index()
            var showTar = $(".show" + ind)
            $(".showHide").not(showTar).hide(0)
            showTar.show(0)
        });
    })
</script>
</html>
